import { Inject, Injectable } from '@nestjs/common';
import { CreateCommentDto } from './dto/create-comment.dto';
import { PrismaService } from 'src/prisma.service';

@Injectable()
export class CommentService {
  @Inject()
  prismaService: PrismaService;
  create(createCommentDto: CreateCommentDto, userId: number) {
    return this.prismaService.comment.create({
      data: {
        content: createCommentDto.content,
        userId,
        articleId: createCommentDto.articleId,
      },
      include: {
        user: {
          include: {
            avatarFile: true,
          },
        },
      },
    });
  }

  // findAll() {
  //   return `This action returns all comment`;
  // }

  // findOne(id: number) {
  //   return `This action returns a #${id} comment`;
  // }

  // update(id: number, updateCommentDto: UpdateCommentDto) {
  //   return `This action updates a #${id} comment`;
  // }

  // remove(id: number) {
  //   return `This action removes a #${id} comment`;
  // }
}
